<?php Yii::app()->publishAndRegisterScriptFile(Yii::getPathOfAlias('common') . '/javascripts/app.plugins.highlight.js'); ?>
<script>
	var phrase = '<?php echo $phrase; ?>';
</script>
<?php
$this->breadcrumbs = array(
	'All Filters' => array('adsControl/allFilters'),
	'FIlter Word / Phrase : "' . strtoupper($phrase) . '"'
);
?>
<div class="main-title no-border">
	<h1 id="phrases-message">Advertisements where the phrase "<?php echo strtoupper($phrase); ?>" is found </h1>
</div>
<div class="grid_16">
	<div class="grid-filter-menu">
		<?php $this->widget('zii.widgets.CMenu', array('items' => $typesLinks)); ?>
	</div>
</div>

<?php
$form = $this->beginWidget('GxActiveForm', array(
	'id' => 'mass-action-form',
	'action' => array('adsControl/massReject', 'type' => $type),
		));
?>

<?php echo CHtml::hiddenField('filterId', $filterId); ?>

<div class="grid_16 relative">
    <div class="manage-advertisements form">
		<?php
		$this->widget('PsGridView', array(
			'id' => 'reject-advertisements-grid',
			'dataProvider' => $dataProvider,
			'filter' => $advertisement,
			'template' => '{items}{pager}{pagesize}',
			'pagerCssClass' => 'pager float-right',
			'pagesizeCssClass' => 'pager-pagesize float-right',
			'htmlOptions' => array(
				'class' => 'grid-view no-shadow'
			),
			'rowCssClassExpression' => '($row % 2 == 0 ? "even" : "odd")',
			'columns' => array(
				'id' => array(
					'class' => 'CCheckBoxColumn',
					'name' => 'id',
					'value' => '$data->id',
					'selectableRows' => 2,
					'checkBoxHtmlOptions' => array(
						'name' => 'advertisement_id[]'
					),
					'htmlOptions' => array(
						'width' => 16
					),
				),
				array(
					'header' => 'Advertisement Message',
					'name' => 'ad_message',
					'htmlOptions' => array('width' => '350px'),
				),
				array(
					'header' => 'Ad Type',
					'name' => 'ad_type_code',
					'htmlOptions' => array('width' => '80px'),
				),
				array(
					'header' => 'Score',
					'name' => 'rejection_score',
					'value' => '$data->rejection_score',
					'filter' => false,
					'htmlOptions' => array('width' => '130px'),
				),
				array(
					'header' => 'Launch Date',
					'name' => 'launch_date',
					'value' => 'Yii::app()->dateFormatter->formatDateTime(strtotime($data->launch_date), "short", null)',
					'filter' => false,
					'htmlOptions' => array('width' => '80px'),
				),
				array(
					'header' => 'Approval Status',
					'name' => 'approval_status',
					'type' => 'raw',
					'filter' => false,
					'value' => 'CHtml::tag("span", array("class" => "ad-approval-status " . str_replace(" ", "-", strtolower($data->getApprovalStatus()))), $data->getApprovalStatus())',
					'htmlOptions' => array('width' => '120px')
				),
				array(
					'header' => 'Submitted By',
					'name' => 'user_name',
					'type' => 'raw',
					'value' => '$data->user->name',
					'htmlOptions' => array('width' => '130px'),
				),
				array(
					'header' => 'Remarks',
					'name' => 'status_remarks',
					'htmlOptions' => array('width' => '140px'),
				)
			)
		));
		?>
    </div>
	<div id="reject-action-form" style="<?php echo ($type == 1 ? 'display:none;' : ''); ?>" >
		<?php
		echo CHtml::dropDownList('bulk_action', '', array(
			'0' => 'Reject',
			'1' => 'Reject & notify applicants of',
		));
		?> <span id="action-selection"> selected advertisements</span> 
		<?php echo GxHtml::submitButton(Yii::t('app', 'Submit'), array('class' => 'float-right', 'name' => 'reject_action_confirm', 'disabled' => 'disabled')); ?>

	</div>
</div>

<?php $this->endWidget(); ?>